package com.fanrenqiji.entity;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Where;

import javax.persistence.*;

import static com.fanrenqiji.entity.BaseEntity.DEL_FLAG_NORMAL;


/**
 * Created by Administrator on 2017/5/23.
 */
@Getter
@Setter
@Entity
@Table(name="tb_parent_media")
@org.hibernate.annotations.Table(appliesTo = "tb_parent_media",comment = "家长素材表")
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate
@org.hibernate.annotations.Cache(region="parent_media", usage = CacheConcurrencyStrategy.READ_WRITE)
public class ParentMediaEntity extends DataEntity{
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Long id;
    @ManyToOne
    @JoinColumn(name="event_id",columnDefinition=("bigint(20) default null comment '事件ID'"))//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
    @Where(clause="del_flag="+DEL_FLAG_NORMAL)
    private EventEntity event;

    @Column(name = "answer_file_url",columnDefinition="varchar(200) default null comment '相关地址'")
    private String answerFileUrl;

    @ManyToOne
    @JoinColumn(name="parent_id",columnDefinition=("bigint(20) default null comment '家长ID'"))//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
    @Where(clause="del_flag="+DEL_FLAG_NORMAL)
    private ParentEntity parent;

    @ManyToOne
    @JoinColumn(name="semester_id",columnDefinition=("bigint(20) default null comment '学期ID'"))//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
    @Where(clause="del_flag="+DEL_FLAG_NORMAL)
    private SemesterEntity semester;
}
